(define (lcg-next a x c m) (modulo (+ (* a x) c) m))

(define seed (box 19814))

(define my-modulus (expt 2 31))
(define my-multiplier 1103515245)
(define my-increment 12345)

(define (random!)
  (let ((value (lcg-next my-multiplier (unbox seed) my-increment my-modulus)))
    (set-box! seed value)
    (arithmetic-shift value -16)))
